package com.gitee.auth;

import com.baomidou.mybatisplus.annotation.*;

import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * @author EalenXie create on 2020/11/24 14:45
 * 认证中心账号表
 */
@TableName("oauth_account")
public class OauthAccount implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
     * 客户端id
     */
    @TableField("client_id")
    @Size(max = 30)
    private String clientId;
    /**
     * 账号名
     */
    @TableField("username")
    @Size(max = 30)
    private String username;
    /**
     * 密码
     */
    @TableField("password")
    @Size(max = 128)
    private String password;

    /**
     * 手机号
     */
    @TableField("mobile")
    @Size(max = 13)
    private String mobile;
    /**
     * 邮箱
     */
    @TableField("email")
    @Size(max = 64)
    private String email;
    /**
     * 账号是否可用 true 可用 false 禁用
     */
    @TableField("enabled")
    private Boolean enabled;
    /**
     * 账号是否未过期  true 未过期 false 过期
     */
    @TableField("account_non_expired")
    private Boolean accountNonExpired;
    /**
     * 账号是否未被锁定 true 未锁定 false 锁定
     */
    @TableField("account_non_locked")
    private Boolean accountNonLocked;
    /**
     * 密码是否未过期 true 未过期 false 过期
     */
    @TableField("credentials_non_expired")
    private Boolean credentialsNonExpired;
    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private Date createdTime;
    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(final String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Boolean getAccountNonExpired() {
        return accountNonExpired;
    }

    public void setAccountNonExpired(Boolean accountNonExpired) {
        this.accountNonExpired = accountNonExpired;
    }

    public Boolean getAccountNonLocked() {
        return accountNonLocked;
    }

    public void setAccountNonLocked(Boolean accountNonLocked) {
        this.accountNonLocked = accountNonLocked;
    }

    public Boolean getCredentialsNonExpired() {
        return credentialsNonExpired;
    }

    public void setCredentialsNonExpired(Boolean credentialsNonExpired) {
        this.credentialsNonExpired = credentialsNonExpired;
    }


    public Date getCreatedTime() {
        if (createdTime == null) return null;
        return (Date) createdTime.clone();
    }

    public void setCreatedTime(Date createdTime) {
        if (createdTime != null) {
            this.createdTime = (Date) createdTime.clone();
        }
    }

    public Date getUpdatedTime() {
        return updatedTime == null ? null : (Date) updatedTime.clone();
    }

    public void setUpdatedTime(Date updatedTime) {
        if (updatedTime != null) {
            this.updatedTime = (Date) updatedTime.clone();
        }
    }

}
